const path = require("path");
const { merge } = require("webpack-merge");
const { PROJECT_ROOT, commonConfig } = require("./common");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const packgeConfig = require("../../cdp-test/package.json");

module.exports = merge(commonConfig, {
  mode: "production",
  entry: "./ui/entry.ts",
  output: {
    filename: "entry.js",
    path: path.resolve(PROJECT_ROOT, "dist/statics"),
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: path.resolve(PROJECT_ROOT, "ui/index.ejs"),
      templateParameters: {
        version: packgeConfig.version,
      },
    }),
  ],
});
